package com.twu.biblioteca;

/**
 * Created by twer on 7/17/14.
 */
public class Movie {
    private int id;
    private String name;
    private String director;
    private int year;
    private int rating;
    private boolean isAvailable;

    public Movie(int id, String name, String director, int year,int rating){
        this.id = id;
        this.name = name;
        this.director = director;
        this.year = year;
        this.rating = rating;
        this.isAvailable = true;
    }

    public String getDetails() {
        return String.format("|%-4s|%-20s|%-13s|%-4s|%-6s|",id, name, director,year,rating);
    }

    public boolean isAvailable() {
        return isAvailable;
    }

    public void checkout(){
        this.isAvailable = false;
    }

    public void checkin(){
        this.isAvailable = true;
    }
}
